def process_logs(log_file):
    with open(log_file, 'r') as file:
        for line in file:
            if "alert" in line and "action" in line and "signature" in line:
                source_ip = line.split('"src_ip":"')[1].split('"')[0]
                dest_ip = line.split('"dest_ip":"')[1].split('"')[0]
                attack_signature = line.split('"signature":"')[1].split('"')[0]

                print("Атака обнаружена:")
                print("Атакующий IP:", source_ip)
                print("Цель атаки:", dest_ip)
                print("Название атаки:", attack_signature)
                print("---")

process_logs('pfsense.log')

